package com.api.invitation.editinvitation;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IInvitationApiService;
import com.zyncro.api.exceptions.ZyncroApiException;
import com.zyncro.api.model.InvitationStateApiType;

@ContextConfiguration(locations = { "classpath:/invitation/invitation-context.xml" })
public class EditInvitationNotInvited extends AbstractApiTest {

	@Value("#{user_notInvited.appId}")
	private String userId;

	@Value("#{user_notInvited.password}")
	private String userPassword;

	@Value("#{user_toGet.invitationUrn}")
	private String invitationUrn;

	@BeforeClass
	public void setUpVariables() {

		getApi().login(userId, userPassword);
	}

	@Test(expectedExceptions = { ZyncroApiException.class })
	public synchronized void testGetInvitation() throws ZyncroApiException {

		InvitationStateApiType state = InvitationStateApiType.ACCEPTED;

		getApi().getService(IInvitationApiService.class).editInvitation(invitationUrn, state);
	}
}
